Skip to content

feat: add OASF taxonomies #39

Open
gilbertsahumada wants to merge 1 commit intoagent0lab:mainfrom
gilbertsahumada:feat/export-taxonomies
Open

feat: add OASF taxonomies #39
gilbertsahumada wants to merge 1 commit intoagent0lab:mainfrom
gilbertsahumada:feat/export-taxonomies

Conversation

@gilbertsahumada
Copy link

Summary

This PR adds public exports for the OASF (Open Agentic Schema Framework) taxonomies that are already bundled in the SDK but were not accessible to consumers.

Problem

The SDK includes OASF taxonomies internally (src/taxonomies/all_skills.json and all_domains.json) which are used for agent categorization. However, these taxonomies are not exported from the package, forcing downstream projects to:

  1. Maintain their own copies of the taxonomy files
  2. Risk version mismatches between their local copies and the SDK's internal version
  3. Manually sync updates when OASF releases new versions

Real-world example

In the trust8004 project, we need to map user-provided skills/domains to standardized OASF slugs. Currently, we maintain local copies of all_skills.json and all_domains.json to do this mapping:

// Current workaround in agent-registration
import allSkills from "@/lib/all_skills.json"  // Local copy, may drift from SDK
import allDomains from "@/lib/all_domains.json"

const SKILL_SLUGS = new Set(Object.keys(allSkills.skills))

This creates a maintenance burden and risk of inconsistency.

Solution

Export the taxonomies via a new subpath export agent0-sdk/taxonomies:

// New usage
import { OASF_SKILLS, OASF_DOMAINS, OASF_VERSION } from 'agent0-sdk/taxonomies';

// Or from main entry point
import { OASF_SKILLS, OASF_SKILL_SLUGS } from 'agent0-sdk';

Changes

1. New file: src/taxonomies/index.ts

Creates a public API for taxonomies with typed exports:

  • OASF_SKILLS - Full skills taxonomy data
  • OASF_DOMAINS - Full domains taxonomy data
  • OASF_SKILL_SLUGS - Set of valid skill slugs (for validation)
  • OASF_DOMAIN_SLUGS - Set of valid domain slugs (for validation)
  • OASF_VERSION - Current OASF version bundled in SDK

2. Updated: package.json

Added new export path:

"exports": {
  ".": { ... },
  "./taxonomies": {
    "types": "./dist/taxonomies/index.d.ts",
    "default": "./dist/taxonomies/index.js"
  },
  "./eip6963": { ... }
}

3. Updated: src/index.ts

Re-exports taxonomies from main entry point for convenience.

Usage Examples

Validate skills against OASF taxonomy

import { OASF_SKILL_SLUGS } from 'agent0-sdk/taxonomies';

function isValidOasfSkill(slug: string): boolean {
  return OASF_SKILL_SLUGS.has(slug);
}

Map user input to OASF slugs

import { OASF_SKILLS } from 'agent0-sdk/taxonomies';

// Build lookup index from captions
const skillIndex = new Map<string, string>();
for (const [slug, entry] of Object.entries(OASF_SKILLS.skills)) {
  if (entry.caption) {
    skillIndex.set(entry.caption.toLowerCase(), slug);
  }
}

// Map "Natural Language Processing" -> "natural_language_processing/..."

Check OASF version

import { OASF_VERSION } from 'agent0-sdk';

console.log(`Using OASF v${OASF_VERSION}`); // "Using OASF v0.8.0"

Benefits

  1. Single source of truth - Consumers use the same taxonomy data as the SDK
  2. Automatic updates - When SDK updates OASF, consumers get it via npm update
  3. Type safety - Typed exports provide autocomplete and compile-time checks
  4. Zero breaking changes - Additive change, no existing API affected

Checklist

  • Added src/taxonomies/index.ts with typed exports
  • Updated package.json exports
  • Re-exported from main entry point
  • Added "oasf" keyword to package.json
  • Tests (if needed)
  • Update README with usage examples

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant